package com.stockz.watchlist.model;

import java.io.Serializable;

import com.stockz.equity.model.Scrip;

public class EntryPrimaryKey implements Serializable {
	private static final long serialVersionUID = -7535043769888235006L;
	
	private WatchList watchList;
	private Scrip scrip;
	
	@Override
	public boolean equals(Object paramObject) {
		if(paramObject != null && paramObject instanceof EntryPrimaryKey){
			EntryPrimaryKey other = (EntryPrimaryKey)paramObject;
			if(other.getWatchList() != null && other.getScrip() != null){
				return other.getWatchList().equals(getWatchList()) && other.getScrip().equals(getScrip());
			}
		}
		return super.equals(paramObject);
	}
	
	@Override
	public int hashCode() {
		if(watchList != null && scrip != null){
			return Integer.parseInt(String.valueOf(watchList.hashCode())+String.valueOf(scrip.hashCode()));
		}else{
			return super.hashCode();
		}
	}
	
	public WatchList getWatchList() {
		return watchList;
	}
	public void setWatchList(WatchList watchList) {
		this.watchList = watchList;
	}
	public Scrip getScrip() {
		return scrip;
	}
	public void setScrip(Scrip scrip) {
		this.scrip = scrip;
	}
}
